#!/bin/bash

# Test cache push in stress

. ./common

for i in `seq 0 1 2`; do
    _start_sheep $i "-w size=200M"
done

_wait_for_sheep 3
_cluster_format -c 2

$DOG vdi create t 300M -P
$DOG vdi create t0 300M -P
$DOG vdi create t1 300M -P

dd if=/dev/zero | $DOG vdi write -w t &
for j in 0 1; do
    dd if=/dev/zero | $DOG vdi write -w t$j -p 700$j &
done

for i in `seq 3 7`; do
    _start_sheep $i
    _wait_for_sheep 4
    _kill_sheep $(($i - 1))
    _wait_for_sheep_recovery 0
done

wait

for i in 0 1 7; do
    $DOG cluster info -p 700$i | _filter_cluster_info
done
